﻿using System.IO;

namespace Ha666.Common
{
    public class ProtobufHelper
    {
        public static T GetObject<T>(byte[] bytes)
        {
            using (MemoryStream stream = new MemoryStream(bytes, 0, bytes.Length))
            {
                stream.Position = 0;
                return (T)ProtoBuf.Meta.RuntimeTypeModel.Default.Deserialize(stream, null, typeof(T));
            };
        }
    }
}
